//
//  WClassCollectionViewCell.m
//  Go!
//
//  Created by 凌風 on 16/7/11.
//  Copyright © 2016年 凌风. All rights reserved.
//

#import "WClassCollectionViewCell.h"

@interface WClassCollectionViewCell ()

@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) UILabel_Font *titleLabel;
@end

@implementation WClassCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
    }
    return self;
}


- (void)layoutSubviews {
    self.imageView.frame = CGRectMake((CGRectGetWidth(self.bounds) - CGRectGetMidX(self.bounds)) / 2.0, 10, 0.5 * self.bounds.size.width, 0.5 * self.bounds.size.width);
//    self.imageView.center = CGPointMake(, CGRectGetMidY(self.imageView.bounds));
    self.imageView.image = [UIImage imageNamed:self.imageName];
    
    [self addSubview:self.imageView];
    
    self.titleLabel.frame = CGRectMake(0, CGRectGetMaxY(self.imageView.frame), CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds) - CGRectGetMaxY(self.imageView.frame));
    
    self.titleLabel.text = self.cellTitle;
    
    [self addSubview:self.titleLabel];
    
}

#pragma mark -- Getter
- (UIImageView *)imageView {
    if (!_imageView) {
        _imageView = [[UIImageView alloc] init];
        
//        _imageView.backgroundColor = [UIColor blueColor];
    }
    
    return _imageView;
}

- (UILabel_Font *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel_Font alloc] init];
//        _titleLabel.backgroundColor = [UIColor greenColor];
        
        _titleLabel.textAlignment = NSTextAlignmentCenter;
    }
    
    return _titleLabel;
}

@end
